package com.renhui.videoplayer;

import android.util.DisplayMetrics;

public class DeviceScreenUtils {
    private static DisplayMetrics metrics;

    public static DisplayMetrics getDisplayMetrics() {
        if (metrics == null) {
            metrics = MyApplication.getInstance().getResources().getDisplayMetrics();
        }

        return metrics;
    }

    public static int getScreenWidth() {
        if (metrics == null) {
            getDisplayMetrics();
        }
        return metrics.widthPixels;
    }

    public static int getScreenHeight() {
        if (metrics == null) {
            getDisplayMetrics();
        }
        return metrics.heightPixels;
    }
}
